/**
 * author: MaHX
 * date: 2019/11/6/19:23
 * description:  选择排序
 **/
public class SelectSort {
    public static void main(String[] args) {
        int [] arrs = new int[]{7,4,5,6,0,5,2,88,1};
        for (int i = 0; i < arrs.length-1; i++) {
            int min = i;
            for (int j = i+1; j < arrs.length; j++) {
                if (arrs[min] > arrs[j]){
                    min = j;
                }
            }
            if (min != i){
                int temp = arrs[i];
                arrs[i] = arrs[min];
                arrs[min] = temp;
            }
        }
        for (int num:arrs
             ) {
            System.out.println(num);
        }
    }
}
